﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace BubbleSurvival
{
    class LightSource : Sprite
    {

        Color lightColor;

        Texture2D lightMask;

        float scale;
        float offset;

        public float Scale
        {
            get { return scale; }
            set { scale = value; }
        }

        public float Offset
        {
            get { return offset; }
        }

        public Color LightColor
        {
            get { return lightColor; }
            set { lightColor = value; }
        }

        const int LIGHTOFFSET = 115;
        const float DEFAULTSCALE = 1f;

        // Konstruktor 1
        public LightSource(Texture2D textureImage, Vector2 position,
                           Point frameSize, Texture2D lightMask)
            : base(textureImage, position, frameSize)
        {
            this.lightMask = lightMask;
            this.scale = DEFAULTSCALE;
            this.offset = LIGHTOFFSET;
            this.lightColor = defaultColor;
        }

        // Konstruktor 2
        public LightSource(Texture2D textureImage, Vector2 position,
                           Point frameSize, Color color,
                           Texture2D lightMask)
            : base(textureImage, position, frameSize, color)
        {
            this.lightMask = lightMask;
            this.scale = DEFAULTSCALE;
            this.offset = LIGHTOFFSET;
            this.lightColor = defaultColor;
        }

        // Konstruktor 3
        public LightSource(Texture2D textureImage, Vector2 position,
                           Point frameSize, int collisionOfset,
                           Texture2D lightMask)
            : base(textureImage, position, frameSize, collisionOfset)
        {
            this.lightMask = lightMask;
            this.scale = DEFAULTSCALE;
            this.offset = LIGHTOFFSET;
            this.lightColor = defaultColor;
        }

        // Konstruktor 4
        public LightSource(Texture2D textureImage, Vector2 position,
                           Point frameSize, int collisionOfset, Color color,
                           Texture2D lightMask)
            : base(textureImage, position, frameSize, collisionOfset, color)
        {
            this.lightMask = lightMask;
            this.scale = DEFAULTSCALE;
            this.offset = LIGHTOFFSET;
            this.lightColor = defaultColor;
        }

        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            
            spriteBatch.Draw(lightMask, positionValue, null, lightColor, 0f,
                             new Vector2(LIGHTOFFSET, LIGHTOFFSET), scale, SpriteEffects.None, 0.1f);

            base.Draw(gameTime, spriteBatch);
        }

    }
}
